<template>
  <div class="common-layout">
    <el-container class="container">
      <!-- 界面头部 -->
      <el-header class="header">
        <div class="header-content">
          <span class="title">界面头部</span>
          <div class="nav">
            <el-button type="text" @click="goHome">首页</el-button>
            <el-button type="text" @click="goSettings">设置</el-button>
          </div>
        </div>
      </el-header>

      <!-- 界面内容 -->
      <el-main class="main">
        <RouterView/>
      </el-main>

      <!-- 界面底部 -->
      <el-footer class="footer">
        界面底部
      </el-footer>
    </el-container>
  </div>
</template>

<script setup>
import { ElMessage } from "element-plus";
import { useRouter,RouterView } from "vue-router";

const router = useRouter();

const goHome = () => {
  router.push("")

};

const goSettings = () => {
  ElMessage.info("跳转到设置");
};
</script>

<style scoped>
/* 让整个页面铺满浏览器窗口 */
.common-layout,
.container {
  height: 100vh; /* 让界面铺满整个视口 */
  display: flex;
  flex-direction: column;
  background-color: #fff; /* 白色背景 */
}

/* 头部固定 */
.header {
  height: 60px;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e0e0e0;
}

/* 头部内容布局 */
.header-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

/* 标题 */
.title {
  font-size: 20px;
  font-weight: bold;
}

/* 按钮导航 */
.nav {
  display: flex;
  gap: 10px;
}

/* 内容区域 */
.main {
  flex: 1; /* 让内容区域填充剩余空间 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #333;
}

/* 底部固定 */
.footer {
  height: 50px;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #e0e0e0;
  font-size: 14px;
  color: #666;
}
</style>
  